import {createRouter, createWebHashHistory} from 'vue-router'
import Main from '@/views/main/main.vue'
import Login from '@/views/login/login.vue'
import Category from '@/views/main/category/category.vue'
import Home from '@/views/main/home/home.vue'
import Commodity from '@/views/main/commodity/commodity.vue'
import User from '@/views/main/user/user.vue'
import Moment from '@/views/main/moment/moment.vue'
import Order from '@/views/main/order/order.vue'

//路由配置
const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {path: '/', redirect: '/login'},
    {
      path: '/main', component: Main,
      children: [
        {path: '', component: Home},
        {path: 'category', component: Category},
        {path: 'commodity', component: Commodity},
        {path: 'moment', component: Moment},
        {path: 'order', component: Order},
        {path: 'user', component: User}
      ]
    },
    {path: '/login', component: Login},
    {path: '/:pathMatch(.*)', redirect: '/'}
  ]
})

export default router
